<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    手机号<input type="number"> <button>发送验证码</button>
    <script>
        var btn = document.querySelector('button');
        var time = 10;
        btn.addEventListener('click', function() {
            btn.disabled = true;
            var timer = setInterval(function() {
                btn.innerHTML = time + '秒后重试';
                if (time == 0) {
                    clearInterval(timer);
                    btn.innerHTML = '发送验证码';
                    btn.disabled = false;
                    time = 10;
                }else {
                    time = time -1;
                }
            }, 1000);
        })
    </script>
</body>
</html>